<?php
require_once("ContentExtractor.php");

 
$extractor = new ContentExtractor();

$requestParams = $_GET;

//=========Test Code=============
//echo "Browsing Images in the directory... \n";
//$filePath = dirname("C:/PERSONAL/photos/./");
//$filePath = dirname("../../photos/./");
//echo "Trying to open $filePath \n";
//echo "Content..." . print_r($extractor->getDirectoryContent($filePath),true);
//$result = $extractor->getDirectoryContent($filePath);
//echo print_r($result,true);
//echo "Request params:". print_r($requestParams,true);
//$result = $extractor->listdirRecursive($filePath);
//=========Test Code=============


$result = $extractor->listdirRecursive($requestParams["path"]);
$resultXml = "<photos>";
foreach($result as $fileName) {
	$changedFileName = substr_replace($fileName,"http://rishikdhar.com/",0,6);
	$resultXml .=  "<image source='$changedFileName' label='$changedFileName' width='200' height='200'/>";
}
$resultXml .= "</photos>";

echo $resultXml;

?>